#ifndef LEVEL_MENAGER_H
#define LEVEL_MENAGER_H

#include <string>

#include "Windows.h"
#include "SquaresList.h"

//wczytywanie, wyswietlanie levelu,
//ogolnie wszystkie rzeczy zwiazane z obsluga plansz

struct LevelInfo {
    const char* Name;
    
    int SqrX, SqrY;
    
    int HowManyPatternsToRead;
       
    int SqrsIDsBank, SqrsIDsAddress;
    int SqrsDataBank, SqrsDataAddress;
    int pal;

    int EnemyAdress;
    int ID;
};

class LevelMenager {
    
    public:
        
        friend class SquaresList;
        
        
        int LoadLevel(int id);
        int DrawLevel(const char* ObjectName, int x, int y);
        
        int DrawCurrentSquare(const char* ObjectName, int x, int y);
        
        int DrawFrame();
        
        int SetDrawObjectName(const char* name);
        
        int MouseClick(int x, int y, int b);
        
        unsigned char GetCurrentSquareID();
        void SetCurrentSquareID(unsigned char id);
        
        inline int GetSquaresX() { return GetLvlInfo()->SqrX; }
        inline int GetSquaresY() { return GetLvlInfo()->SqrY; }
        inline int GetPixelsX() { return GetLvlInfo()->SqrX*32; }
        inline int GetPixelsY() { return GetLvlInfo()->SqrY*32; }
        inline const char* GetLevelName() { return GetLvlInfo()->Name; }
        inline int GetEnemyAdr() { return GetLvlInfo()->EnemyAdress; }
        inline int GetID() { return GetLvlInfo()->ID; }
        
        
        inline int GetCurrentLvl() { return LvlCur; }
        
    private:
        
        int DrawSquare(const char* ObjectName, int address, int x, int y);
        const LevelInfo* GetLvlInfo();
        
        int PositionX;
        struct {
            int x;
            int y;
        }SqrCur;
        
        std::string WindowName;
        
        int LvlCur; //current level
        
        LevelInfo Info;
             
}; 


#endif //LEVEL_MENAGER
